﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Agoods.aspx.cs" Inherits="pufflesweb.Agoods" %>
<%@ import Namespace="PBLL" %>
<%@ import Namespace="PDAL" %>
<%@ import Namespace="PModel" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>商品管理</title>
    
</head>
<body>
    
    <form id="form1" runat="server" >
        <div >
            <br />
            <asp:TextBox ID="TextBox1" placeholder="请输入工号" runat="server"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" Text="搜索" />
            <a href="Agoodsadd.aspx">发布商品</a>

            <br />
            <table  width="1200"  border="1">

                <tr><td>商品ID</td><td>名称</td>
                    <td>价格</td><td>标题</td>
                    <td>介绍</td><td>图片</td>
                    <td>数量</td><td>发货地址</td>
                    <td>类型</td><td>状态</td>
                    <td>发布时间</td><td>操作</td></tr>

                <%
                    string id = Request.QueryString["GID"];
                    if(id != null)
                    {
                        PBLL.Goods.del(int.Parse(id));
                        PF.JsHelper.AlertAndRedirect("删除成功","Agoods.aspx");
                    }

                    List<PModel.Goods> list = PBLL.Goods.list();
                    %>
                <% for (int i = 0; i < list.Count; i++)
                    {
                        string gstate = "";
                        if (list[i].Gstate == 0)
                        {
                            gstate = "上架";
                        }
                        else
                        {
                            gstate = "下架";
                        }

                        string gtype = "";
                        if(list[i].Gtype == 0)
                        {
                            gtype = "食物";
                        }
                        else if(list[i].Gtype == 1)
                        {
                            gtype = "服饰";
                        }
                        else if(list[i].Gtype == 2)
                        {
                            gtype = "玩具";
                        }
                        else if(list[i].Gtype == 3)
                        {
                            gtype = "日常用品";
                        }
                        else if(list[i].Gtype == 4)
                        {
                            gtype = "洗漱用品";
                        }
                        else
                        {
                            gtype = "其他";
                        }

                        %>

                <tr>
                    <td><%=list[i].GID%></td>
                    <td><% =list[i].Gname%></td>
                    <td><%=list[i].Gprice%></td>
                    <td><%=list[i].Gtitle%></td>
                    <td><%=list[i].Gtext%></td>
                    <td><img src="../goodsimg/<%=list[i].Gimage%>" width="100px" /></td>
                    <td><%=list[i].Gnumber%></td>
                    <td><%=list[i].Gaddress%></td>
                    <td><%=gtype%></td>
                    <td><%=gstate%></td>
                    <td><%=list[i].Gtime%></td>
                    <td><a href="Agoods.aspx?GID=<%=list[i].GID%>">删除</a> | <a href="Agoodsupdate.aspx?GID=<%=list[i].GID%>">修改</a></td></tr>
                <%} %>
            </table>
            
        </div>
    </form>
</body>
</html>
